import React from "react";

export default class KeyDemo extends React.Component{
    constructor(){
        super()
        this.state={
            userinfo:[
                {
                    name:"vaien",
                    age:20,
                    sex:'男'
                },{
                    name:"vi2en",
                    age:21,
                    sex:'男'
                },{
                    name:"svien",
                    age:22,
                    sex:'男'
                }
            ]
        }
    }

    render(){
        return (
            <div>
                <ul>
                    {
                        this.state.userinfo.map((item,index)=>{
                            return(
                                <li key={index}>
                                   <span>{item.name} </span>
                                   <span>{item.age} </span> 
                                   <span>{item.sex} </span> 
                                </li>
                            )
                        })
                    }
                </ul>
            </div>
        )
    }
}